def get_ascii_description(char_code):
    """获取ASCII字符的描述信息"""
    descriptions = {
        0: "NUL (空字符)",
        1: "SOH (标题开始)",
        2: "STX (正文开始)",
        3: "ETX (正文结束)",
        4: "EOT (传输结束)",
        5: "ENQ (请求)",
        6: "ACK (确认)",
        7: "BEL (响铃)",
        8: "BS (退格)",
        9: "TAB (水平制表)",
        10: "LF (换行)",
        11: "VT (垂直制表)",
        12: "FF (换页)",
        13: "CR (回车)",
        14: "SO (移出)",
        15: "SI (移入)",
        16: "DLE (数据链路转义)",
        17: "DC1 (设备控制1)",
        18: "DC2 (设备控制2)",
        19: "DC3 (设备控制3)",
        20: "DC4 (设备控制4)",
        21: "NAK (拒绝)",
        22: "SYN (同步)",
        23: "ETB (传输块结束)",
        24: "CAN (取消)",
        25: "EM (媒介结束)",
        26: "SUB (替换)",
        27: "ESC (退出)",
        28: "FS (文件分隔符)",
        29: "GS (组分隔符)",
        30: "RS (记录分隔符)",
        31: "US (单元分隔符)",
        32: "Space (空格)",
        127: "DEL (删除)"
    }
    
    if char_code in descriptions:
        return descriptions[char_code]
    elif 33 <= char_code <= 126:
        return f"可打印字符 ({chr(char_code)})"
    else:
        return "扩展ASCII字符"

def get_escape_sequence(char_code):
    """获取转义字符表示"""
    escape_sequences = {
        0: "\\0",
        7: "\\a",
        8: "\\b",
        9: "\\t",
        10: "\\n",
        11: "\\v",
        12: "\\f",
        13: "\\r",
        27: "\\e",
        92: "\\\\",
        39: "\\'",
        34: '\\"'
    }
    
    if char_code in escape_sequences:
        return escape_sequences[char_code]
    elif char_code < 32 or char_code == 127:
        return f"\\x{char_code:02x}"
    else:
        return chr(char_code)

def main():
    # 打印Markdown表头
    print("| 二进制 | 十进制 | HTML实体字符 | 代码 | 转义字符 | 解释 |")
    print("|--------|--------|------|------|----------|------|")
    
    # 打印表格内容（0-127标准ASCII）
    for char_code in range(128):
        binary = f"{char_code:08b}"
        decimal = str(char_code)
        
        # 字符列
        if 32 <= char_code <= 126 and char_code != 127:
            char_display = chr(char_code)
        else:
            char_display = " "
        
        # 代码列（HTML实体）
        if char_code < 32 or char_code == 127:
            code_display = f"`&#{char_code};`"
        else:
            code_display = f"`&#{char_code};`"
        
        # 转义字符
        escape_char = get_escape_sequence(char_code)
        
        # 解释
        description = get_ascii_description(char_code)
        
        # 输出行
        print(f"| `{binary}` | {decimal} | `{char_display}` | {code_display} | `{escape_char}` | {description} |")

if __name__ == "__main__":
    main()